extends Node

var peer = ENetMultiplayerPeer.new()

func _ready() -> void:
	multiplayer.connection_failed.connect(_connection_failed_info)
	multiplayer.connected_to_server.connect(_connection_to_server)

func _on_connect_button_up() -> void:
	peer.create_client(str($Ip.text), int($Port.text))
	multiplayer.multiplayer_peer = peer
	print('连接中...')

func _connection_failed_info() -> void:
	print('连接失败')

func _connection_to_server() -> void:
	get_tree().change_scene_to_file("res://scene/main.tscn")

func _on_back_button_up() -> void:
	get_tree().change_scene_to_file("res://scene/scene_select.tscn")
